package com.ehome.poct.core.pasre.report.symbol;

import com.ehome.poct.base.api.enums.StripTypeEnums;
import com.ehome.poct.core.pasre.report.symbol.dto.ReportSymbolDTO;

import java.math.BigDecimal;

/**
 * @auther: kuiba.peng
 * @date: 2022/11/10 14:26
 * @description:
 */
public class HBA1CSymbolStrategy implements SymbolStrategy {
    @Override
    public StripTypeEnums getStripType() {
        return StripTypeEnums.HBA1C;
    }

    @Override
    public String getSymbol(ReportSymbolDTO reportSymbolDTO) {
        String reference = getReference(reportSymbolDTO);
        BigDecimal low = new BigDecimal(reference.substring(0, reference.indexOf("~")));
        BigDecimal high = new BigDecimal(reference.substring(reference.indexOf("~") + 1));
        if (low.compareTo(reportSymbolDTO.getCheckResult()) > 0) {
            return "↓";
        }
        if (high.compareTo(reportSymbolDTO.getCheckResult()) < 0) {
            return "↑";
        }
        return "";
    }
}
